﻿using System;
using System.Collections.Generic;

namespace RakutenProxy.Model.Rakuten
{
    public class Product : IEquatable<RakutenProxy.Model.NopCommerce.Product>
    {
        public Product()
        {
            ProductAttributeCombinations = new List<ProductAttributeCombination>();
            Product_ProductAttribute_Mappings = new List<Product_ProductAttribute_Mapping>();            
        }

        public int ProductId { get; set; }

        public int CategoryId { get; set; }

        public string ProductName { get; set; }

        public byte[] ThumbnailImage { get; set; }

        public int CurrencyId { get; set; }

        public decimal Price { get; set; }

        public string DetailHtml { get; set; }

        public int? ManufacturerId { get; set; }

        public string ShortDescription { get; set; }

        public string DetailDescription { get; set; }

        public string Url { get; set; }

        public string PurchaseFormFormat { get; set; }

        public string PurchaseActionUrl { get; set; }

        public string AllowedQuantity { get; set; }

        public DateTime InsertedDate { get; set; }

        public bool IsDelete { get; set; }

        public virtual ICollection<Product_ProductAttribute_Mapping> Product_ProductAttribute_Mappings { get; set; }

        
        public virtual Manufacturer Manufacturer { get; set; }

        public virtual Category Category { get; set; }

        public virtual ICollection<ProductAttributeCombination> ProductAttributeCombinations { get; set; }

        public virtual Currency Currency { get; set; }

        public bool Equals(NopCommerce.Product other)
        {
            var name = this.ProductName.Equals(other.Name);
            var price = this.Price.Equals(other.Price);
            var allowedQuantity = this.AllowedQuantity.Equals(other.AllowedQuantities);
            var shortDescription = this.ShortDescription.Equals(other.ShortDescription);
            var detailDescription = this.DetailHtml.Equals(other.FullDescription);

            return name && price && allowedQuantity && shortDescription && detailDescription;
        }
    }
}